import 'package:flutter/material.dart';
import 'package:chart_sparkline/chart_sparkline.dart';

class Yunxsj extends StatefulWidget {
  const Yunxsj({Key? key}) : super(key: key);

  @override
  _YunxsjState createState() => _YunxsjState();
}

class _YunxsjState extends State<Yunxsj> {
  @override
  Widget build(BuildContext context) {
    var data = [0.0, 1.0, 1.5, 2.0, 0.0, 0.0, -0.5, -1.0, -0.5, 0.0, 0.0];
    return Scaffold(
      body: Center(
        child: Container(
          width: 300.0,
          height: 100.0,
          child: Sparkline(
            data: data,
            backgroundColor: Colors.red,
            lineColor: Colors.lightGreen[500]!,
            fillMode: FillMode.below,
            fillColor: Colors.lightGreen[200]!,
            pointsMode: PointsMode.all,
            pointSize: 5.0,
            pointColor: Colors.amber,
            useCubicSmoothing: true,
            lineWidth: 1.0,
            gridLinelabelPrefix: '\$',
            gridLineLabelPrecision: 3,
            enableGridLines: true,
            averageLine: true,
            averageLable: true,
            kLine: ['max', 'min', 'first', 'last'],
            enableThreshold: true,
            thresholdSize: 0.1,
            lineGradient: LinearGradient(
              begin: Alignment.topCenter,
              end: Alignment.bottomCenter,
              colors: [Colors.purple[800]!, Colors.purple[200]!],
            ),
            fillGradient: LinearGradient(
              begin: Alignment.topCenter,
              end: Alignment.bottomCenter,
              colors: [Colors.red[800]!, Colors.red[200]!],
            ),
          ),
        ),
      ),
    );
  }
}
